/**
 * ...
 * @author Sasha
 */

package
{

import flash.display.MovieClip;
import flash.display.GradientType;
import flash.geom.Matrix;
import flash.events.MouseEvent;

public class Trect extends TControl
{	
	public function Trect(Parent: TControl,  Col: uint, x: int, y: int, aWidth: int, aHeight: int, Gradient: Boolean = false, 
	       RotateGradient: Boolean = false, DuplicateColor: Boolean = false, Col2: uint = 0xFFFFFF) 
	{		
		var Pic: MovieClip = new MovieClip();
		super(Pic, Parent, x, y);		
		
		if (Gradient)
		{
			var topBarLittleMatrix:Matrix = new Matrix();
			var Agle: Number;
			if (RotateGradient)
			  Agle = - Math.PI / 2
			else
			  Agle = 0;
			topBarLittleMatrix.createGradientBox(aWidth, aHeight, Agle);		
			if (DuplicateColor)
				Pic.graphics.beginGradientFill(GradientType.LINEAR, [Col, Col, Col2], [1, 1, 1], [0, 64, 255], topBarLittleMatrix)
			else
				Pic.graphics.beginGradientFill(GradientType.LINEAR, [Col, Col2], [1, 1], [0, 255], topBarLittleMatrix);
			Pic.graphics.drawRect(0, 0, aWidth, aHeight);
			Pic.graphics.endFill();
		} else
		{
			Pic.graphics.beginFill(Col);
			Pic.graphics.drawRect(0, 0, aWidth, aHeight);
			Pic.graphics.endFill();			
		}
	}
	
}
}